/*
\ * 文件名：RecruitMentController.java	 
 * 时     间：下午4:20:10
 * 作     者：liyf       
 * 版     权： 2014-2022  智慧园区, 公司保留所有权利.
 * 联     系：www.szyungu.com
 */
package com.cz073586.technology.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.cz073586.common.contants.CommonContans;
import com.cz073586.common.controller.BaseController;
import com.cz073586.common.entity.pojo.PageInfo;
import com.cz073586.technology.model.RecruitMent;
import com.cz073586.technology.service.face.RecruitMentService;
import com.cz073586.tools.privilege.ResourceAndOperate;
import com.cz073586.tools.util.UUIDGenerateUtil;

/**
 * @ClassName: RecruitMentController
 * @Description: 这里用一句话描述这个类的作用
 * @author zengqj
 * @date 2015年1月20日 下午4:20:10
 */
@RestController
@RequestMapping(value = "/RecruitMent", method = RequestMethod.POST)
@ResourceAndOperate(
		moduleID = "com.technology.RecruitMent", 
		moduleName = "招聘管理", 
		resouceDesc = "招聘管理",
		parentModuleID = "com.technology", 
		parentModuleName = "昱显科技项目"
		)
public class RecruitMentController extends BaseController
{
	@Autowired
	private RecruitMentService recruitMentService;
	
	/**
	 * 
	 * @方法名称: queryServicesByPage
	 * @描述: 查询招聘列表
	 *
	 * @参数:
	 * @param page
	 * @return
	 *
	 * @返回类型: ModelMap
	 * @作者:zengqj
	 * @可能抛出异常:
	 */
	@RequestMapping(value = "/queryRecruitMentByPage.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.RecruitMent.queryRecruitMentListByPage", 
			moduleName = "通过分页对象查询", 
			resouceDesc = "查询分页",
			parentModuleID = "com.technology.RecruitMent", 
			parentModuleName = "招聘管理"
			)
	public ModelMap queryRecruitMentByPage(@RequestBody RecruitMent recruitMent)
	{
		ModelMap resultMap = new ModelMap();
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA, recruitMentService.queryByObject(recruitMent));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	
	/**
	 * 
	 * @方法名称: queryRecruitMentById
	 * @描述: 通过招聘ID查询
	 *
	 * @参数:
	 * @param RecruitMentId
	 * @return
	 *
	 * @返回类型: ModelMap
	 * @作者:zengqj
	 * @可能抛出异常:
	 */
	@RequestMapping(value = "/queryRecruitMentById.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.RecruitMent.queryRecruitMentById", 
			moduleName = "查询单一招聘", 
			resouceDesc = "通过ID查询招聘",
			parentModuleID = "com.technology.RecruitMent", 
			parentModuleName = "招聘管理"
			)
	public ModelMap queryRecruitMentById(String RecruitMentId)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			
			resultMap.put(CommonContans.STRUTS_DATA,
					recruitMentService.selectByPrimaryKey(RecruitMentId));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：添加招聘信息，uuid由代码写入
	 * 
	 * @Title: insertRecruitMent
	 * @param @param RecruitMent
	 * @param @return
	 * @return ModelMap
	 * @RecruitMent Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/insertRecruitMent.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.RecruitMent.insertRecruitMent", 
			moduleName = "添加", 
			resouceDesc = "添加招聘",
			parentModuleID = "com.technology.RecruitMent", 
			parentModuleName = "招聘管理"
			)
	public ModelMap insertRecruitMent(@RequestBody RecruitMent RecruitMent)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			RecruitMent.setUuid(UUIDGenerateUtil.generate());
			resultMap.put(CommonContans.STRUTS_DATA,
					recruitMentService.insert(RecruitMent));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：根据RecruitMent主机修改招聘信息
	 * 
	 * @Title: updateRecruitMent
	 * @param @param RecruitMent
	 * @param @return
	 * @return ModelMap
	 * @RecruitMent Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/updateRecruitMent.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.RecruitMent.updateRecruitMent", 
			moduleName = "修改", 
			resouceDesc = "修改",
			parentModuleID = "com.technology.RecruitMent", 
			parentModuleName = "招聘管理"
			)
	public ModelMap updateRecruitMent(@RequestBody RecruitMent RecruitMent)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA,
					recruitMentService.updateByPrimaryKeySelective(RecruitMent));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：根据主键删除招聘
	 * 
	 * @Title: deleteRecruitMent
	 * @param @param RecruitMentId
	 * @param @return
	 * @return ModelMap
	 * @RecruitMent Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/deleteRecruitMent.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.RecruitMent.deleteRecruitMent", 
			moduleName = "删除", 
			resouceDesc = "删除",
			parentModuleID = "com.technology.RecruitMent", 
			parentModuleName = "招聘管理"
			)
	public ModelMap deleteRecruitMent(String RecruitMentId)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA,
					recruitMentService.deleteByPrimaryKey(RecruitMentId));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
}
